
<!DOCTYPE HTML>
<html lang="zh-hans" >
<head>
    <meta charset="UTF-8">
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
    <title>Flutter动画简介 · 《Flutter实战》</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <meta name="baidu-site-verification" content="Y34sAqDKUH"/>
    <meta name="theme-color" content="#ffffff">
    <!--<meta name="description" content="">-->
    <meta name="description" content="《Flutter实战》是Flutter中文网（https://flutterchina.club）开源的电子书，旨在帮助开发者系统化的了解并学习Flutter。">
    <meta name="keywords" content="flutter实战,flutter书籍,flutter电子书,flutter中文网 ">
    <meta name="generator" content="GitBook 3.2.3">
    
    <meta name="author" content="wendux 824783146@qq.com">
    
    
    
    
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/flutterchina/flutter-in-action/_book/gitbook/style.css">

    
    
    
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/flutterchina/flutter-in-action/_book/gitbook/gitbook-plugin-search-pro/search.css">
    
    
    
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/flutterchina/flutter-in-action/_book/gitbook/gitbook-plugin-ace/ace.css">
    
    
    
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/flutterchina/flutter-in-action/_book/gitbook/gitbook-plugin-splitter/splitter.css">
    
    
    
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/flutterchina/flutter-in-action/_book/gitbook/gitbook-plugin-toggle-chapters/toggle.css">
    
    
    
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/flutterchina/flutter-in-action/_book/gitbook/gitbook-plugin-prism/prism.css">
    
    
    
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/flutterchina/flutter-in-action/_book/gitbook/gitbook-plugin-donate/plugin.css">
    
    
    
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/flutterchina/flutter-in-action/_book/gitbook/gitbook-plugin-fontsettings/website.css">
    
    
    

    

    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="https://cdn.jsdelivr.net/gh/flutterchina/flutter-in-action/_book/gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="https://cdn.jsdelivr.net/gh/flutterchina/flutter-in-action/_book/gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="animation_structure.html" />
    
    
    <link rel="prev" href="./" />
    

    <style>
        .pull-right > i {
            font-size: 25px;
            color: #777 !important;
            cursor: pointer;

        }

        .pull-right > i:hover {
            color: #777 !important;
        }

        body {
            font-size: 15px !important;
        }

        a[href='../todo.html'], a[href='todo.html'] {
            color: #888 !important;
        }

        .copyright {
            text-align: center;
            margin: 80px 16px 30px 16px;
            padding-top: 16px;
            border-top: #eee 1px solid;
            color: grey;
            font-size: .9em;
        }

        .ad {
            color: white;
            text-align: center;
            background: url(https://img.alicdn.com/tfs/TB1Huu7vMmTBuNjy1XbXXaMrVXa-2880-400.png);
            background-size: cover;
            cursor: pointer;
            margin-bottom: 30px;
            padding: 18px
        }

        .ad:hover {
            opacity: .8;
        }
    </style>
</head>
<body>
<!--<div id="ad" style="display: none">-->
    <!--<div class="ad ad0"-->
         <!--onclick="_track('aliyun','https://promotion.aliyun.com/ntms/yunparter/invite.html?userCode=8hhi4dts')">-->
        <!--<div style="font-size: 1.3em; padding-right: 120px; position: relative; top: 12px">阿里云新春特惠</div>-->
        <!--<div style="color:orange; font-size: 13px">限时红包 最高￥<span style="font-size: 40px">1888</span></div>-->
    <!--</div>-->
    <!--<div class="ad ad1"-->
         <!--onclick="_track('aliyun-puhui','https://promotion.aliyun.com/ntms/act/qwbk.html?spm=5176.11533457.1089570.10.74e877e33jtaGy&userCode=8hhi4dts')">-->
        <!--<div style="font-size: 1.5em;">阿里云全民云计算-新春特惠</div>-->
        <!--<div style="color:orange; font-size: 18px;padding-top: 4px;">普惠上云，云服务器1核1G仅需293元/年</div>-->
    <!--</div>-->
<!--</div>-->

<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    
    
        
        <li>
            <a href="https://flutterchina.club" target="_blank" class="custom-link"><div><img height=20 style='position:relative; top:5px; padding-right:5px ' src='https://cdn.jsdelivr.net/gh/flutterchina/website@1.0/images/favicon.png'/> Flutter中文网</div></a>
        </li>
    
    

    
    <li class="divider"></li>
    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    缘起
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../chapter1/">
            
                <a href="../chapter1/">
            
                    
                    起步
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../chapter1/mobile_development_intro.html">
            
                <a href="../chapter1/mobile_development_intro.html">
            
                    
                    移动开发技术简介
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../chapter1/flutter_intro.html">
            
                <a href="../chapter1/flutter_intro.html">
            
                    
                    Flutter简介
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="../chapter1/install_flutter.html">
            
                <a href="../chapter1/install_flutter.html">
            
                    
                    搭建Flutter开发环境
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4" data-path="../chapter1/configuration.html">
            
                <a href="../chapter1/configuration.html">
            
                    
                    常见配置问题
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.5" data-path="../chapter1/dart.html">
            
                <a href="../chapter1/dart.html">
            
                    
                    Dart语言简介
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../chapter2/">
            
                <a href="../chapter2/">
            
                    
                    第一个Flutter应用
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../chapter2/first_flutter_app.html">
            
                <a href="../chapter2/first_flutter_app.html">
            
                    
                    计数器示例
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../chapter2/flutter_router.html">
            
                <a href="../chapter2/flutter_router.html">
            
                    
                    路由管理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="../chapter2/flutter_package_mgr.html">
            
                <a href="../chapter2/flutter_package_mgr.html">
            
                    
                    包管理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="../chapter2/flutter_assets_mgr.html">
            
                <a href="../chapter2/flutter_assets_mgr.html">
            
                    
                    资源管理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5" data-path="../chapter2/flutter_app_debug.html">
            
                <a href="../chapter2/flutter_app_debug.html">
            
                    
                    调试Flutter APP
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.6" data-path="../chapter2/thread_model_and_error_report.html">
            
                <a href="../chapter2/thread_model_and_error_report.html">
            
                    
                    Dart线程模型及异常捕获
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../chapter3/">
            
                <a href="../chapter3/">
            
                    
                    基础Widgets
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../chapter3/flutter_widget_intro.html">
            
                <a href="../chapter3/flutter_widget_intro.html">
            
                    
                    Widget简介
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../chapter3/text.html">
            
                <a href="../chapter3/text.html">
            
                    
                    文本、字体样式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="../chapter3/buttons.html">
            
                <a href="../chapter3/buttons.html">
            
                    
                    按钮
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4" data-path="../chapter3/img_and_icon.html">
            
                <a href="../chapter3/img_and_icon.html">
            
                    
                    图片和Icon
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5" data-path="../chapter3/radio_and_checkbox.html">
            
                <a href="../chapter3/radio_and_checkbox.html">
            
                    
                    单选框和复选框
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.6" data-path="../chapter3/input_and_form.html">
            
                <a href="../chapter3/input_and_form.html">
            
                    
                    输入框和表单
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="../chapter4/">
            
                <a href="../chapter4/">
            
                    
                    布局类Widgets
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="../chapter4/intro.html">
            
                <a href="../chapter4/intro.html">
            
                    
                    布局类Widgets简介
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="../chapter4/row_and_column.html">
            
                <a href="../chapter4/row_and_column.html">
            
                    
                    线性布局Row、Column
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3" data-path="../chapter4/flex.html">
            
                <a href="../chapter4/flex.html">
            
                    
                    弹性布局Flex
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.4" data-path="../chapter4/wrap_and_flow.html">
            
                <a href="../chapter4/wrap_and_flow.html">
            
                    
                    流式布局Wrap、Flow
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.5" data-path="../chapter4/stack.html">
            
                <a href="../chapter4/stack.html">
            
                    
                    层叠布局Stack、Positioned
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="../chapter5/">
            
                <a href="../chapter5/">
            
                    
                    容器类Widgets
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="../chapter5/padding.html">
            
                <a href="../chapter5/padding.html">
            
                    
                    Padding
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="../chapter5/constrainedbox_and_sizebox.html">
            
                <a href="../chapter5/constrainedbox_and_sizebox.html">
            
                    
                    布局限制类容器ConstrainedBox、SizeBox
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3" data-path="../chapter5/decoratedbox.html">
            
                <a href="../chapter5/decoratedbox.html">
            
                    
                    装饰容器DecoratedBox
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.4" data-path="../chapter5/transform.html">
            
                <a href="../chapter5/transform.html">
            
                    
                    变换Transform
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.5" data-path="../chapter5/container.html">
            
                <a href="../chapter5/container.html">
            
                    
                    Container容器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.6" data-path="../chapter5/material_scaffold.html">
            
                <a href="../chapter5/material_scaffold.html">
            
                    
                    Scaffold、TabBar、底部导航
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="../chapter6/">
            
                <a href="../chapter6/">
            
                    
                    可滚动Widgets
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" data-path="../chapter6/intro.html">
            
                <a href="../chapter6/intro.html">
            
                    
                    可滚动Widgets简介
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2" data-path="../chapter6/single_child_scrollview.html">
            
                <a href="../chapter6/single_child_scrollview.html">
            
                    
                    SingleChildScrollView
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3" data-path="../chapter6/listview.html">
            
                <a href="../chapter6/listview.html">
            
                    
                    ListView
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.4" data-path="../chapter6/gridview.html">
            
                <a href="../chapter6/gridview.html">
            
                    
                    GridView
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.5" data-path="../chapter6/custom_scrollview.html">
            
                <a href="../chapter6/custom_scrollview.html">
            
                    
                    CustomScrollView
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6" data-path="../chapter6/scroll_controller.html">
            
                <a href="../chapter6/scroll_controller.html">
            
                    
                    滚动监听及控制ScrollController
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="../chapter7/">
            
                <a href="../chapter7/">
            
                    
                    功能型Widgets
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.8.1" data-path="../chapter7/willpopscope.html">
            
                <a href="../chapter7/willpopscope.html">
            
                    
                    导航返回拦截-WillPopScope
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.2" data-path="../chapter7/inherited_widget.html">
            
                <a href="../chapter7/inherited_widget.html">
            
                    
                    数据共享-InheritedWidget
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.3" data-path="../chapter7/theme.html">
            
                <a href="../chapter7/theme.html">
            
                    
                    主题-Theme
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="../chapter8/">
            
                <a href="../chapter8/">
            
                    
                    事件处理与通知
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.9.1" data-path="../chapter8/listener.html">
            
                <a href="../chapter8/listener.html">
            
                    
                    原始指针事件处理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.2" data-path="../chapter8/gesture.html">
            
                <a href="../chapter8/gesture.html">
            
                    
                    手势识别
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.3" data-path="../chapter8/eventbus.html">
            
                <a href="../chapter8/eventbus.html">
            
                    
                    全局事件总线
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.4" data-path="../chapter8/notification.html">
            
                <a href="../chapter8/notification.html">
            
                    
                    通知Notification
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.10" data-path="./">
            
                <a href="./">
            
                    
                    动画
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter active" data-level="1.10.1" data-path="intro.html">
            
                <a href="intro.html">
            
                    
                    Flutter动画简介
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.2" data-path="animation_structure.html">
            
                <a href="animation_structure.html">
            
                    
                    动画结构
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.3" data-path="route_transition.html">
            
                <a href="route_transition.html">
            
                    
                    自定义路由过渡动画
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.4" data-path="hero.html">
            
                <a href="hero.html">
            
                    
                    Hero动画
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.5" data-path="stagger_animation.html">
            
                <a href="stagger_animation.html">
            
                    
                    交错动画
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.11" data-path="../chapter13/">
            
                <a href="../chapter13/">
            
                    
                    自定义Widget
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.11.1" data-path="../chapter13/intro.html">
            
                <a href="../chapter13/intro.html">
            
                    
                    自定义Widget方法简介
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.2" data-path="../chapter13/combine.html">
            
                <a href="../chapter13/combine.html">
            
                    
                    通过组合现有Widget实现
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.3" data-path="../chapter13/turn_box.html">
            
                <a href="../chapter13/turn_box.html">
            
                    
                    实例：TurnBox
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.4" data-path="../chapter13/custom_paint.html">
            
                <a href="../chapter13/custom_paint.html">
            
                    
                    CustomPaint与Canvas
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.5" data-path="../chapter13/gradient_circular_progress_demo.html">
            
                <a href="../chapter13/gradient_circular_progress_demo.html">
            
                    
                    实例：圆形渐变进度条(自绘)
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.12" data-path="../chapter10/">
            
                <a href="../chapter10/">
            
                    
                    文件操作与网络请求
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.12.1" data-path="../chapter10/file_operation.html">
            
                <a href="../chapter10/file_operation.html">
            
                    
                    文件操作
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.2" data-path="../chapter10/http.html">
            
                <a href="../chapter10/http.html">
            
                    
                    Http请求-HttpClient
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.3" data-path="../chapter10/dio.html">
            
                <a href="../chapter10/dio.html">
            
                    
                    Http请求-Dio package
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.4" data-path="../chapter10/download_with_chunks.html">
            
                <a href="../chapter10/download_with_chunks.html">
            
                    
                    实例：Http分块下载
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.5" data-path="../chapter10/websocket.html">
            
                <a href="../chapter10/websocket.html">
            
                    
                    WebSocket
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.6" data-path="../chapter10/socket.html">
            
                <a href="../chapter10/socket.html">
            
                    
                    使用Socket API
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.7" data-path="../chapter10/json_model.html">
            
                <a href="../chapter10/json_model.html">
            
                    
                    Json转Model
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.13" data-path="../chapter11/">
            
                <a href="../chapter11/">
            
                    
                    包与插件
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.13.1" data-path="../chapter11/develop_package.html">
            
                <a href="../chapter11/develop_package.html">
            
                    
                    开发package
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.2" data-path="../chapter11/platform-channel.html">
            
                <a href="../chapter11/platform-channel.html">
            
                    
                    插件开发：平台通道简介
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.3" data-path="../chapter11/android_implement.html">
            
                <a href="../chapter11/android_implement.html">
            
                    
                    插件开发：实现Android端API
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.4" data-path="../chapter11/ios_implement.html">
            
                <a href="../chapter11/ios_implement.html">
            
                    
                    插件开发：实现IOS端API
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.5" data-path="../todo.html">
            
                <a href="../todo.html">
            
                    
                    系统能力调用
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.14" data-path="../chapter12/">
            
                <a href="../chapter12/">
            
                    
                    国际化
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.14.1" data-path="../chapter12/multi_languages_support.html">
            
                <a href="../chapter12/multi_languages_support.html">
            
                    
                    让App支持多语言
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.14.2" data-path="../chapter12/locallization_implement.html">
            
                <a href="../chapter12/locallization_implement.html">
            
                    
                    实现Localizations
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.14.3" data-path="../chapter12/intl.html">
            
                <a href="../chapter12/intl.html">
            
                    
                    使用Intl包
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.15" data-path="../chapter14/">
            
                <a href="../chapter14/">
            
                    
                    Flutter核心原理
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.15.1" data-path="../chapter14/flutter_ui_system.html">
            
                <a href="../chapter14/flutter_ui_system.html">
            
                    
                    Flutter UI系统
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15.2" data-path="../chapter14/element_buildcontext.html">
            
                <a href="../chapter14/element_buildcontext.html">
            
                    
                    Element和BuildContext
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15.3" data-path="../chapter14/render_object.html">
            
                <a href="../chapter14/render_object.html">
            
                    
                    RenderObject与RenderBox
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15.4" data-path="../chapter14/flutter_app_startup.html">
            
                <a href="../chapter14/flutter_app_startup.html">
            
                    
                    Flutter从启动到显示
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    
        
        <li class="divider"></li>
        
        
    
        <li class="chapter " data-level="2.1" data-path="../todo.html">
            
                <a href="../todo.html">
            
                    
                    Flutter资源汇总
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    
    <a class="btn pull-right" aria-label="GitHub">
        <i class="fa fa-edit" title="编辑本文"></i>
    </a>
    <a class="btn pull-right" aria-label="GitHub" href="https://github.com/flutterchina/flutter-in-action">
        <i class="fa fa-github" title="查看本书开源项目"></i>
    </a>
    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >Flutter动画简介</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="&#x52A8;&#x753B;">&#x52A8;&#x753B;</h1>
<p>&#x5728;&#x4EFB;&#x4F55;&#x7CFB;&#x7EDF;&#x7684;UI&#x6846;&#x67B6;&#x4E2D;&#xFF0C;&#x52A8;&#x753B;&#x5B9E;&#x73B0;&#x7684;&#x539F;&#x7406;&#x90FD;&#x662F;&#x76F8;&#x540C;&#x7684;&#xFF0C;&#x5373;&#xFF1A;&#x5728;&#x4E00;&#x6BB5;&#x65F6;&#x95F4;&#x5185;&#xFF0C;&#x5FEB;&#x901F;&#x5730;&#x591A;&#x6B21;&#x6539;&#x53D8;UI&#x5916;&#x89C2;&#xFF0C;&#x7531;&#x4E8E;&#x4EBA;&#x773C;&#x4F1A;&#x4EA7;&#x751F;&#x89C6;&#x89C9;&#x6682;&#x7559;&#xFF0C;&#x6700;&#x7EC8;&#x770B;&#x5230;&#x7684;&#x5C31;&#x662F;&#x4E00;&#x4E2A;&#x201C;&#x8FDE;&#x7EED;&#x201D;&#x7684;&#x52A8;&#x753B;&#xFF0C;&#x8FD9;&#x548C;&#x7535;&#x5F71;&#x7684;&#x539F;&#x7406;&#x662F;&#x4E00;&#x6837;&#x7684;&#xFF0C;&#x800C;UI&#x7684;&#x4E00;&#x6B21;&#x6539;&#x53D8;&#x79F0;&#x4E3A;&#x4E00;&#x4E2A;&#x52A8;&#x753B;&#x5E27;&#xFF0C;&#x5BF9;&#x5E94;&#x4E00;&#x6B21;&#x5C4F;&#x5E55;&#x5237;&#x65B0;&#xFF0C;&#x800C;&#x51B3;&#x5B9A;&#x52A8;&#x753B;&#x6D41;&#x7545;&#x5EA6;&#x7684;&#x4E00;&#x4E2A;&#x91CD;&#x8981;&#x6307;&#x6807;&#x5C31;&#x662F;&#x5E27;&#x7387;FPS&#xFF08;Frame Per Second&#xFF09;&#xFF0C;&#x6307;&#x6BCF;&#x79D2;&#x7684;&#x52A8;&#x753B;&#x5E27;&#x6570;&#x3002;&#x5F88;&#x660E;&#x663E;&#xFF0C;&#x5E27;&#x7387;&#x8D8A;&#x9AD8;&#x5219;&#x52A8;&#x753B;&#x5C31;&#x4F1A;&#x8D8A;&#x6D41;&#x7545;&#x3002;&#x4E00;&#x822C;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;&#x5BF9;&#x4E8E;&#x4EBA;&#x773C;&#x6765;&#x8BF4;&#xFF0C;&#x52A8;&#x753B;&#x5E27;&#x7387;&#x8D85;&#x8FC7;16FPS&#xFF0C;&#x5C31;&#x6BD4;&#x8F83;&#x6D41;&#x7545;&#x4E86;&#xFF0C;&#x8D85;&#x8FC7;32FPS&#x5C31;&#x4F1A;&#x975E;&#x5E38;&#x7684;&#x7EC6;&#x817B;&#x5E73;&#x6ED1;&#xFF0C;&#x800C;&#x8D85;&#x8FC7;32FPS&#x57FA;&#x672C;&#x5C31;&#x611F;&#x53D7;&#x4E0D;&#x5230;&#x5DEE;&#x522B;&#x4E86;&#x3002;&#x7531;&#x4E8E;&#x52A8;&#x753B;&#x7684;&#x6BCF;&#x4E00;&#x5E27;&#x90FD;&#x662F;&#x8981;&#x6539;&#x53D8;UI&#x8F93;&#x51FA;&#xFF0C;&#x6240;&#x4EE5;&#x5728;&#x4E00;&#x4E2A;&#x65F6;&#x95F4;&#x6BB5;&#x5185;&#x8FDE;&#x7EED;&#x7684;&#x6539;&#x53D8;UI&#x8F93;&#x51FA;&#x662F;&#x6BD4;&#x8F83;&#x8017;&#x8D44;&#x6E90;&#x7684;&#xFF0C;&#x5BF9;&#x8BBE;&#x5907;&#x7684;&#x8F6F;&#x786C;&#x4EF6;&#x7CFB;&#x7EDF;&#x8981;&#x6C42;&#x90FD;&#x8F83;&#x9AD8;&#xFF0C;&#x6240;&#x4EE5;&#x5728;UI&#x7CFB;&#x7EDF;&#x4E2D;&#xFF0C;&#x52A8;&#x753B;&#x7684;&#x5E73;&#x5747;&#x5E27;&#x7387;&#x662F;&#x91CD;&#x8981;&#x7684;&#x6027;&#x80FD;&#x6307;&#x6807;&#xFF0C;&#x800C;&#x5728;Flutter&#x4E2D;&#xFF0C;&#x7406;&#x60F3;&#x60C5;&#x51B5;&#x4E0B;&#x662F;&#x53EF;&#x4EE5;&#x5B9E;&#x73B0;60FPS&#x7684;&#xFF0C;&#x8FD9;&#x548C;&#x539F;&#x751F;&#x5E94;&#x7528;&#x52A8;&#x753B;&#x57FA;&#x672C;&#x662F;&#x6301;&#x5E73;&#x7684;&#x3002;</p>
<h3 id="flutter&#x4E2D;&#x52A8;&#x753B;&#x62BD;&#x8C61;">Flutter&#x4E2D;&#x52A8;&#x753B;&#x62BD;&#x8C61;</h3>
<p>&#x4E3A;&#x4E86;&#x65B9;&#x4FBF;&#x5F00;&#x53D1;&#x8005;&#x521B;&#x5EFA;&#x52A8;&#x753B;&#xFF0C;&#x4E0D;&#x540C;&#x7684;UI&#x7CFB;&#x7EDF;&#x5BF9;&#x52A8;&#x753B;&#x90FD;&#x8FDB;&#x884C;&#x4E86;&#x4E00;&#x4E9B;&#x62BD;&#x8C61;&#xFF0C;&#x6BD4;&#x5982;&#x5728;Android&#x4E2D;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;XML&#x6765;&#x63CF;&#x8FF0;&#x4E00;&#x4E2A;&#x52A8;&#x753B;&#x7136;&#x540E;&#x8BBE;&#x7F6E;&#x7ED9;View&#x3002;Flutter&#x4E2D;&#x4E5F;&#x5BF9;&#x52A8;&#x753B;&#x8FDB;&#x884C;&#x4E86;&#x62BD;&#x8C61;&#xFF0C;&#x4E3B;&#x8981;&#x6D89;&#x53CA;Tween&#x3001;Animation&#x3001;Curve&#x3001;Controller&#x8FD9;&#x4E9B;&#x89D2;&#x8272;&#x3002;</p>
<h3 id="animation">Animation</h3>
<p>Animation&#x5BF9;&#x8C61;&#x672C;&#x8EAB;&#x548C;UI&#x6E32;&#x67D3;&#x6CA1;&#x6709;&#x4EFB;&#x4F55;&#x5173;&#x7CFB;&#x3002;Animation&#x662F;&#x4E00;&#x4E2A;&#x62BD;&#x8C61;&#x7C7B;&#xFF0C;&#x5B83;&#x7528;&#x4E8E;&#x4FDD;&#x5B58;&#x52A8;&#x753B;&#x7684;&#x63D2;&#x503C;&#x548C;&#x72B6;&#x6001;&#xFF1B;&#x5176;&#x4E2D;&#x4E00;&#x4E2A;&#x6BD4;&#x8F83;&#x5E38;&#x7528;&#x7684;Animation&#x7C7B;&#x662F;Animation<double>&#x3002;Animation&#x5BF9;&#x8C61;&#x662F;&#x4E00;&#x4E2A;&#x5728;&#x4E00;&#x6BB5;&#x65F6;&#x95F4;&#x5185;&#x4F9D;&#x6B21;&#x751F;&#x6210;&#x4E00;&#x4E2A;&#x533A;&#x95F4;(Tween)&#x4E4B;&#x95F4;&#x503C;&#x7684;&#x7C7B;&#x3002;Animation&#x5BF9;&#x8C61;&#x7684;&#x8F93;&#x51FA;&#x503C;&#x53EF;&#x4EE5;&#x662F;&#x7EBF;&#x6027;&#x7684;&#x3001;&#x66F2;&#x7EBF;&#x7684;&#x3001;&#x4E00;&#x4E2A;&#x6B65;&#x8FDB;&#x51FD;&#x6570;&#x6216;&#x8005;&#x4EFB;&#x4F55;&#x5176;&#x4ED6;&#x66F2;&#x7EBF;&#x51FD;&#x6570;&#x3002; &#x6839;&#x636E;Animation&#x5BF9;&#x8C61;&#x7684;&#x63A7;&#x5236;&#x65B9;&#x5F0F;&#xFF0C;&#x52A8;&#x753B;&#x53EF;&#x4EE5;&#x53CD;&#x5411;&#x8FD0;&#x884C;&#xFF0C;&#x751A;&#x81F3;&#x53EF;&#x4EE5;&#x5728;&#x4E2D;&#x95F4;&#x5207;&#x6362;&#x65B9;&#x5411;&#x3002;Animation&#x8FD8;&#x53EF;&#x4EE5;&#x751F;&#x6210;&#x9664;double&#x4E4B;&#x5916;&#x7684;&#x5176;&#x4ED6;&#x7C7B;&#x578B;&#x503C;&#xFF0C;&#x5982;&#xFF1A;Animation\<color> &#x6216; Animation\<size>&#x3002;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;Animation&#x5BF9;&#x8C61;&#x7684;<code>value</code>&#x5C5E;&#x6027;&#x83B7;&#x53D6;&#x52A8;&#x753B;&#x7684;&#x5F53;&#x524D;&#x503C;&#x3002;</size></color></double></p>
<h4 id="&#x52A8;&#x753B;&#x901A;&#x77E5;">&#x52A8;&#x753B;&#x901A;&#x77E5;</h4>
<p>&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;Animation&#x6765;&#x76D1;&#x542C;&#x52A8;&#x753B;&#x7684;&#x5E27;&#x548C;&#x72B6;&#x6001;&#x53D8;&#x5316;&#xFF1A;</p>
<ol>
<li><code>addListener()</code>&#x53EF;&#x4EE5;&#x7ED9;Animation&#x6DFB;&#x52A0;&#x5E27;&#x76D1;&#x542C;&#x5668;&#xFF0C;&#x5728;&#x6BCF;&#x4E00;&#x5E27;&#x90FD;&#x4F1A;&#x88AB;&#x8C03;&#x7528;&#x3002;&#x5E27;&#x76D1;&#x542C;&#x5668;&#x4E2D;&#x6700;&#x5E38;&#x89C1;&#x7684;&#x884C;&#x4E3A;&#x662F;&#x6539;&#x53D8;&#x72B6;&#x6001;&#x540E;&#x8C03;&#x7528;setState()&#x6765;&#x89E6;&#x53D1;UI&#x91CD;&#x5EFA;&#x3002;</li>
<li><code>addStatusListener()</code>&#x53EF;&#x4EE5;&#x7ED9;Animation&#x6DFB;&#x52A0;&#x201C;&#x52A8;&#x753B;&#x72B6;&#x6001;&#x6539;&#x53D8;&#x201D;&#x76D1;&#x542C;&#x5668;&#xFF1B;&#x52A8;&#x753B;&#x5F00;&#x59CB;&#x3001;&#x7ED3;&#x675F;&#x3001;&#x6B63;&#x5411;&#x6216;&#x53CD;&#x5411;&#xFF08;&#x89C1;AnimationStatus&#x5B9A;&#x4E49;&#xFF09;&#x65F6;&#x4F1A;&#x8C03;&#x7528;StatusListener&#x3002;</li>
</ol>
<p>&#x5728;&#x540E;&#x9762;&#x7684;&#x7AE0;&#x8282;&#x4E2D;&#x6211;&#x4EEC;&#x5C06;&#x4F1A;&#x4E3E;&#x4F8B;&#x8BF4;&#x660E;&#x3002;</p>
<h3 id="curve">Curve</h3>
<p>&#x52A8;&#x753B;&#x8FC7;&#x7A0B;&#x53EF;&#x4EE5;&#x662F;&#x5300;&#x901F;&#x7684;&#x3001;&#x52A0;&#x901F;&#x7684;&#x6216;&#x8005;&#x5148;&#x52A0;&#x901F;&#x540E;&#x51CF;&#x901F;&#x7B49;&#x3002;Flutter&#x4E2D;&#x901A;&#x8FC7;Curve&#xFF08;&#x66F2;&#x7EBF;&#xFF09;&#x6765;&#x63CF;&#x8FF0;&#x52A8;&#x753B;&#x8FC7;&#x7A0B;&#xFF0C;Curve&#x53EF;&#x4EE5;&#x662F;&#x7EBF;&#x6027;&#x7684;(Curves.linear)&#xFF0C;&#x4E5F;&#x53EF;&#x4EE5;&#x662F;&#x975E;&#x7EBF;&#x6027;&#x7684;&#x3002;</p>
<p>CurvedAnimation &#x5C06;&#x52A8;&#x753B;&#x8FC7;&#x7A0B;&#x5B9A;&#x4E49;&#x4E3A;&#x4E00;&#x4E2A;&#x975E;&#x7EBF;&#x6027;&#x66F2;&#x7EBF;.</p>
<pre class="language-"><code class="lang-dart"><span class="token keyword">final</span> CurvedAnimation curve <span class="token operator">=</span>
    <span class="token keyword">new</span> <span class="token class-name">CurvedAnimation</span><span class="token punctuation">(</span>parent<span class="token punctuation">:</span> controller<span class="token punctuation">,</span> curve<span class="token punctuation">:</span> Curves<span class="token punctuation">.</span>easeIn<span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
<p><strong>&#x6CE8;:</strong> <a href="https://docs.flutter.io/flutter/animation/Curves-class.html" target="_blank">Curves</a> &#x7C7B;&#x7C7B;&#x5B9A;&#x4E49;&#x4E86;&#x8BB8;&#x591A;&#x5E38;&#x7528;&#x7684;&#x66F2;&#x7EBF;&#xFF0C;&#x4E5F;&#x53EF;&#x4EE5;&#x521B;&#x5EFA;&#x81EA;&#x5DF1;&#x7684;&#xFF0C;&#x4F8B;&#x5982;&#xFF1A;</p>
<pre class="language-"><code class="lang-dart"><span class="token keyword">class</span> <span class="token class-name">ShakeCurve</span> <span class="token keyword">extends</span> <span class="token class-name">Curve</span> <span class="token punctuation">{</span>
  <span class="token metadata symbol">@override</span>
  double <span class="token function">transform</span><span class="token punctuation">(</span>double t<span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token keyword">return</span> math<span class="token punctuation">.</span><span class="token function">sin</span><span class="token punctuation">(</span>t <span class="token operator">*</span> math<span class="token punctuation">.</span>PI <span class="token operator">*</span> <span class="token number">2</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre>
<p>CurvedAnimation&#x548C;AnimationController&#xFF08;&#x4E0B;&#x9762;&#x4ECB;&#x7ECD;&#xFF09;&#x90FD;&#x662F;Animation<double>&#x7C7B;&#x578B;&#x3002;CurvedAnimation&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x5305;&#x88C5;AnimationController&#x548C;Curve&#x751F;&#x6210;&#x4E00;&#x4E2A;&#x65B0;&#x7684;&#x52A8;&#x753B;&#x5BF9;&#x8C61; &#x3002;</double></p>
<h3 id="animationcontroller">AnimationController</h3>
<p>AnimationController&#x7528;&#x4E8E;&#x63A7;&#x5236;&#x52A8;&#x753B;&#xFF0C;&#x5B83;&#x5305;&#x542B;&#x52A8;&#x753B;&#x7684;&#x542F;&#x52A8;<code>forward()</code>&#x3001;&#x505C;&#x6B62;<code>stop()</code> &#x3001;&#x53CD;&#x5411;&#x64AD;&#x653E; <code>reverse()</code>&#x7B49;&#x65B9;&#x6CD5;&#x3002;AnimationController&#x4F1A;&#x5728;&#x52A8;&#x753B;&#x7684;&#x6BCF;&#x4E00;&#x5E27;&#xFF0C;&#x5C31;&#x4F1A;&#x751F;&#x6210;&#x4E00;&#x4E2A;&#x65B0;&#x7684;&#x503C;&#x3002;&#x9ED8;&#x8BA4;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;AnimationController&#x5728;&#x7ED9;&#x5B9A;&#x7684;&#x65F6;&#x95F4;&#x6BB5;&#x5185;&#x7EBF;&#x6027;&#x7684;&#x751F;&#x6210;&#x4ECE;0.0&#x5230;1.0&#xFF08;&#x9ED8;&#x8BA4;&#x533A;&#x95F4;&#xFF09;&#x7684;&#x6570;&#x5B57;&#x3002; &#x4F8B;&#x5982;&#xFF0C;&#x4E0B;&#x9762;&#x4EE3;&#x7801;&#x521B;&#x5EFA;&#x4E00;&#x4E2A;Animation&#x5BF9;&#x8C61;&#xFF0C;&#x4F46;&#x4E0D;&#x4F1A;&#x542F;&#x52A8;&#x5B83;&#x8FD0;&#x884C;&#xFF1A;</p>
<pre class="language-"><code class="lang-dart"><span class="token keyword">final</span> AnimationController controller <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">AnimationController</span><span class="token punctuation">(</span>
    duration<span class="token punctuation">:</span> <span class="token keyword">const</span> <span class="token function">Duration</span><span class="token punctuation">(</span>milliseconds<span class="token punctuation">:</span> <span class="token number">2000</span><span class="token punctuation">)</span><span class="token punctuation">,</span> vsync<span class="token punctuation">:</span> <span class="token keyword">this</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
<p>AnimationController&#x751F;&#x6210;&#x6570;&#x5B57;&#x7684;&#x533A;&#x95F4;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;<code>lowerBound</code>&#x548C;<code>upperBound</code>&#x6765;&#x6307;&#x5B9A;&#xFF0C;&#x5982;&#xFF1A;</p>
<pre class="language-"><code class="lang-dart"><span class="token keyword">final</span> AnimationController controller <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">AnimationController</span><span class="token punctuation">(</span> 
 duration<span class="token punctuation">:</span> <span class="token keyword">const</span> <span class="token function">Duration</span><span class="token punctuation">(</span>milliseconds<span class="token punctuation">:</span> <span class="token number">2000</span><span class="token punctuation">)</span><span class="token punctuation">,</span> 
 lowerBound<span class="token punctuation">:</span> <span class="token number">10.0</span><span class="token punctuation">,</span>
 upperBound<span class="token punctuation">:</span> <span class="token number">20.0</span><span class="token punctuation">,</span>
 vsync<span class="token punctuation">:</span> <span class="token keyword">this</span>
<span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
<p>AnimationController&#x6D3E;&#x751F;&#x81EA;Animation<double>&#xFF0C;&#x56E0;&#x6B64;&#x53EF;&#x4EE5;&#x5728;&#x9700;&#x8981;Animation&#x5BF9;&#x8C61;&#x7684;&#x4EFB;&#x4F55;&#x5730;&#x65B9;&#x4F7F;&#x7528;&#x3002; &#x4F46;&#x662F;&#xFF0C;AnimationController&#x5177;&#x6709;&#x63A7;&#x5236;&#x52A8;&#x753B;&#x7684;&#x5176;&#x4ED6;&#x65B9;&#x6CD5;&#xFF0C;&#x4F8B;&#x5982;<code>forward()</code>&#x65B9;&#x6CD5;&#x53EF;&#x4EE5;&#x542F;&#x52A8;&#x52A8;&#x753B;&#x3002;&#x6570;&#x5B57;&#x7684;&#x4EA7;&#x751F;&#x4E0E;&#x5C4F;&#x5E55;&#x5237;&#x65B0;&#x6709;&#x5173;&#xFF0C;&#x56E0;&#x6B64;&#x6BCF;&#x79D2;&#x949F;&#x901A;&#x5E38;&#x4F1A;&#x4EA7;&#x751F;60&#x4E2A;&#x6570;&#x5B57;(&#x5373;60fps)&#xFF0C;&#x5728;&#x52A8;&#x753B;&#x7684;&#x6BCF;&#x4E00;&#x5E27;&#xFF0C;&#x751F;&#x6210;&#x65B0;&#x7684;&#x6570;&#x5B57;&#x540E;&#xFF0C;&#x6BCF;&#x4E2A;Animation&#x5BF9;&#x8C61;&#x4F1A;&#x8C03;&#x7528;&#x5176;Listener&#x5BF9;&#x8C61;&#x56DE;&#x8C03;&#xFF0C;&#x7B49;&#x52A8;&#x753B;&#x72B6;&#x6001;&#x53D1;&#x751F;&#x6539;&#x53D8;&#x65F6;&#xFF08;&#x5982;&#x52A8;&#x753B;&#x7ED3;&#x675F;&#xFF09;&#x4F1A;&#x8C03;&#x7528;StatusListeners&#x76D1;&#x542C;&#x5668;&#x3002;</double></p>
<p>duration&#x8868;&#x793A;&#x52A8;&#x753B;&#x6267;&#x884C;&#x7684;&#x65F6;&#x957F;&#xFF0C;&#x901A;&#x8FC7;&#x5B83;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x63A7;&#x5236;&#x52A8;&#x753B;&#x7684;&#x901F;&#x5EA6;&#x3002;</p>
<blockquote>
<p><strong>&#x6CE8;&#x610F;</strong>&#xFF1A; &#x5728;&#x67D0;&#x4E9B;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;&#x52A8;&#x753B;&#x503C;&#x53EF;&#x80FD;&#x4F1A;&#x8D85;&#x51FA;AnimationController&#x7684;0.0-1.0&#x7684;&#x8303;&#x56F4;&#x3002;&#x4F8B;&#x5982;&#xFF0C;<code>fling()</code>&#x51FD;&#x6570;&#x5141;&#x8BB8;&#x60A8;&#x63D0;&#x4F9B;&#x901F;&#x5EA6;(velocity)&#x3001;&#x529B;&#x91CF;(force)&#x7B49;&#xFF0C;&#x56E0;&#x6B64;&#x53EF;&#x4EE5;&#x5728;0.0&#x5230;1.0&#x8303;&#x56F4;&#x4E4B;&#x5916;&#x3002; CurvedAnimation&#x751F;&#x6210;&#x7684;&#x503C;&#x4E5F;&#x53EF;&#x4EE5;&#x8D85;&#x51FA;0.0&#x5230;1.0&#x7684;&#x8303;&#x56F4;&#x3002;&#x6839;&#x636E;&#x9009;&#x62E9;&#x7684;&#x66F2;&#x7EBF;&#xFF0C;CurvedAnimation&#x7684;&#x8F93;&#x51FA;&#x53EF;&#x4EE5;&#x5177;&#x6709;&#x6BD4;&#x8F93;&#x5165;&#x66F4;&#x5927;&#x7684;&#x8303;&#x56F4;&#x3002;&#x4F8B;&#x5982;&#xFF0C;Curves.elasticIn&#x7B49;&#x5F39;&#x6027;&#x66F2;&#x7EBF;&#x4F1A;&#x751F;&#x6210;&#x5927;&#x4E8E;&#x6216;&#x5C0F;&#x4E8E;&#x9ED8;&#x8BA4;&#x8303;&#x56F4;&#x7684;&#x503C;&#x3002;</p>
</blockquote>
<h4 id="ticker">Ticker</h4>
<p>&#x5F53;&#x521B;&#x5EFA;&#x4E00;&#x4E2A;AnimationController&#x65F6;&#xFF0C;&#x9700;&#x8981;&#x4F20;&#x9012;&#x4E00;&#x4E2A;<code>vsync</code>&#x53C2;&#x6570;&#xFF0C;&#x5B83;&#x63A5;&#x6536;&#x4E00;&#x4E2A;TickerProvider&#x7C7B;&#x578B;&#x7684;&#x5BF9;&#x8C61;&#xFF0C;&#x5B83;&#x7684;&#x4E3B;&#x8981;&#x804C;&#x8D23;&#x662F;&#x521B;&#x5EFA;Ticker&#xFF0C;&#x5B9A;&#x4E49;&#x5982;&#x4E0B;&#xFF1A;</p>
<pre class="language-"><code class="lang-dart"><span class="token keyword">abstract</span> <span class="token keyword">class</span> <span class="token class-name">TickerProvider</span> <span class="token punctuation">{</span>
  <span class="token comment">//&#x901A;&#x8FC7;&#x4E00;&#x4E2A;&#x56DE;&#x8C03;&#x521B;&#x5EFA;&#x4E00;&#x4E2A;Ticker</span>
  Ticker <span class="token function">createTicker</span><span class="token punctuation">(</span>TickerCallback onTick<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</code></pre>
<p>Flutter&#x5E94;&#x7528;&#x5728;&#x542F;&#x52A8;&#x65F6;&#x90FD;&#x4F1A;&#x7ED1;&#x5B9A;&#x4E00;&#x4E2A;SchedulerBinding&#xFF0C;&#x901A;&#x8FC7;SchedulerBinding&#x53EF;&#x4EE5;&#x7ED9;&#x6BCF;&#x4E00;&#x6B21;&#x5C4F;&#x5E55;&#x5237;&#x65B0;&#x6DFB;&#x52A0;&#x56DE;&#x8C03;&#xFF0C;&#x800C;Ticker&#x5C31;&#x662F;&#x901A;&#x8FC7;SchedulerBinding&#x6765;&#x6DFB;&#x52A0;&#x5C4F;&#x5E55;&#x5237;&#x65B0;&#x56DE;&#x8C03;&#xFF0C;&#x8FD9;&#x6837;&#x4E00;&#x6765;&#xFF0C;&#x6BCF;&#x6B21;&#x5C4F;&#x5E55;&#x5237;&#x65B0;&#x90FD;&#x4F1A;&#x8C03;&#x7528;TickerCallback&#x3002;&#x4F7F;&#x7528;Ticker(&#x800C;&#x4E0D;&#x662F;Timer)&#x6765;&#x9A71;&#x52A8;&#x52A8;&#x753B;&#x4F1A;&#x9632;&#x6B62;&#x5C4F;&#x5E55;&#x5916;&#x52A8;&#x753B;&#xFF08;&#x52A8;&#x753B;&#x7684;UI&#x4E0D;&#x5728;&#x5F53;&#x524D;&#x5C4F;&#x5E55;&#x65F6;&#xFF0C;&#x5982;&#x9501;&#x5C4F;&#x65F6;&#xFF09;&#x6D88;&#x8017;&#x4E0D;&#x5FC5;&#x8981;&#x7684;&#x8D44;&#x6E90;&#xFF0C;&#x56E0;&#x4E3A;Flutter&#x4E2D;&#x5C4F;&#x5E55;&#x5237;&#x65B0;&#x65F6;&#x4F1A;&#x901A;&#x77E5;&#x5230;&#x7ED1;&#x5B9A;&#x7684;SchedulerBinding&#xFF0C;&#x800C;Ticker&#x662F;&#x53D7;SchedulerBinding&#x9A71;&#x52A8;&#x7684;&#xFF0C;&#x7531;&#x4E8E;&#x9501;&#x5C4F;&#x540E;&#x5C4F;&#x5E55;&#x4F1A;&#x505C;&#x6B62;&#x5237;&#x65B0;&#xFF0C;&#x6240;&#x4EE5;Ticker&#x5C31;&#x4E0D;&#x4F1A;&#x518D;&#x89E6;&#x53D1;&#x3002;</p>
<p>&#x901A;&#x8FC7;&#x5C06;SingleTickerProviderStateMixin&#x6DFB;&#x52A0;&#x5230;State&#x7684;&#x5B9A;&#x4E49;&#x4E2D;&#xFF0C;&#x7136;&#x540E;&#x5C06;State&#x5BF9;&#x8C61;&#x4F5C;&#x4E3A;<code>vsync</code>&#x7684;&#x503C;&#xFF0C;&#x8FD9;&#x5728;&#x540E;&#x9762;&#x7684;&#x4F8B;&#x5B50;&#x4E2D;&#x53EF;&#x4EE5;&#x89C1;&#x5230;&#x3002;</p>
<h3 id="tween">Tween</h3>
<p>&#x9ED8;&#x8BA4;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;AnimationController&#x5BF9;&#x8C61;&#x503C;&#x7684;&#x8303;&#x56F4;&#x662F;0.0&#x5230;1.0&#x3002;&#x5982;&#x679C;&#x6211;&#x4EEC;&#x9700;&#x8981;&#x4E0D;&#x540C;&#x7684;&#x8303;&#x56F4;&#x6216;&#x4E0D;&#x540C;&#x7684;&#x6570;&#x636E;&#x7C7B;&#x578B;&#xFF0C;&#x5219;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;Tween&#x6765;&#x914D;&#x7F6E;&#x52A8;&#x753B;&#x4EE5;&#x751F;&#x6210;&#x4E0D;&#x540C;&#x7684;&#x8303;&#x56F4;&#x6216;&#x6570;&#x636E;&#x7C7B;&#x578B;&#x7684;&#x503C;&#x3002;&#x4F8B;&#x5982;&#xFF0C;&#x50CF;&#x4E0B;&#x9762;&#x793A;&#x4F8B;&#xFF0C;Tween&#x751F;&#x6210;&#x4ECE;-200.0&#x5230;0.0&#x7684;&#x503C;&#xFF1A;</p>
<pre class="language-"><code class="lang-dart"><span class="token keyword">final</span> Tween doubleTween <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">Tween</span><span class="token operator">&lt;</span>double<span class="token operator">&gt;</span><span class="token punctuation">(</span>begin<span class="token punctuation">:</span> <span class="token operator">-</span><span class="token number">200.0</span><span class="token punctuation">,</span> end<span class="token punctuation">:</span> <span class="token number">0.0</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
<p>Tween&#x6784;&#x9020;&#x51FD;&#x6570;&#x9700;&#x8981;<code>begin</code>&#x548C;<code>end</code>&#x4E24;&#x4E2A;&#x53C2;&#x6570;&#x3002;Tween&#x7684;&#x552F;&#x4E00;&#x804C;&#x8D23;&#x5C31;&#x662F;&#x5B9A;&#x4E49;&#x4ECE;&#x8F93;&#x5165;&#x8303;&#x56F4;&#x5230;&#x8F93;&#x51FA;&#x8303;&#x56F4;&#x7684;&#x6620;&#x5C04;&#x3002;&#x8F93;&#x5165;&#x8303;&#x56F4;&#x901A;&#x5E38;&#x4E3A;0.0&#x5230;1.0&#xFF0C;&#x4F46;&#x8FD9;&#x4E0D;&#x662F;&#x5FC5;&#x987B;&#x7684;&#xFF0C;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x81EA;&#x5B9A;&#x4E49;&#x9700;&#x8981;&#x7684;&#x8303;&#x56F4;&#x3002;</p>
<p>Tween&#x7EE7;&#x627F;&#x81EA;Animatable<t>&#xFF0C;&#x800C;&#x4E0D;&#x662F;&#x7EE7;&#x627F;&#x81EA;Animation<t>&#x3002;Animatable&#x4E0E;Animation&#x76F8;&#x4F3C;&#xFF0C;&#x4E0D;&#x662F;&#x5FC5;&#x987B;&#x8F93;&#x51FA;double&#x503C;&#x3002;&#x4F8B;&#x5982;&#xFF0C;ColorTween&#x6307;&#x5B9A;&#x4E24;&#x79CD;&#x989C;&#x8272;&#x4E4B;&#x95F4;&#x7684;&#x8FC7;&#x6E21;&#x3002;</t></t></p>
<pre class="language-"><code class="lang-dart"><span class="token keyword">final</span> Tween colorTween <span class="token operator">=</span>
    <span class="token keyword">new</span> <span class="token class-name">ColorTween</span><span class="token punctuation">(</span>begin<span class="token punctuation">:</span> Colors<span class="token punctuation">.</span>transparent<span class="token punctuation">,</span> end<span class="token punctuation">:</span> Colors<span class="token punctuation">.</span>black54<span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
<p>Tween&#x5BF9;&#x8C61;&#x4E0D;&#x5B58;&#x50A8;&#x4EFB;&#x4F55;&#x72B6;&#x6001;&#xFF0C;&#x76F8;&#x53CD;&#xFF0C;&#x5B83;&#x63D0;&#x4F9B;&#x4E86;<code>evaluate(Animation<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>double</span><span class="token punctuation">&gt;</span></span> animation)</code>&#x65B9;&#x6CD5;&#xFF0C;&#x5B83;&#x53EF;&#x4EE5;&#x83B7;&#x53D6;&#x52A8;&#x753B;&#x5F53;&#x524D;&#x503C;&#x3002; Animation&#x5BF9;&#x8C61;&#x7684;&#x5F53;&#x524D;&#x503C;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;<code>value()</code>&#x65B9;&#x6CD5;&#x53D6;&#x5230;&#x3002;<code>evaluate</code>&#x51FD;&#x6570;&#x8FD8;&#x6267;&#x884C;&#x4E00;&#x4E9B;&#x5176;&#x5B83;&#x5904;&#x7406;&#xFF0C;&#x4F8B;&#x5982;&#x5206;&#x522B;&#x786E;&#x4FDD;&#x5728;&#x52A8;&#x753B;&#x503C;&#x4E3A;0.0&#x548C;1.0&#x65F6;&#x8FD4;&#x56DE;&#x5F00;&#x59CB;&#x548C;&#x7ED3;&#x675F;&#x72B6;&#x6001;&#x3002;</p>
<h4 id="tweenanimate">Tween.animate</h4>
<p>&#x8981;&#x4F7F;&#x7528;Tween&#x5BF9;&#x8C61;&#xFF0C;&#x9700;&#x8981;&#x8C03;&#x7528;&#x5176;<code>animate()</code>&#x65B9;&#x6CD5;&#xFF0C;&#x7136;&#x540E;&#x4F20;&#x5165;&#x4E00;&#x4E2A;&#x63A7;&#x5236;&#x5668;&#x5BF9;&#x8C61;&#x3002;&#x4F8B;&#x5982;&#xFF0C;&#x4EE5;&#x4E0B;&#x4EE3;&#x7801;&#x5728;500&#x6BEB;&#x79D2;&#x5185;&#x751F;&#x6210;&#x4ECE;0&#x5230;255&#x7684;&#x6574;&#x6570;&#x503C;&#x3002;</p>
<pre class="language-"><code class="lang-dart"><span class="token keyword">final</span> AnimationController controller <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">AnimationController</span><span class="token punctuation">(</span>
    duration<span class="token punctuation">:</span> <span class="token keyword">const</span> <span class="token function">Duration</span><span class="token punctuation">(</span>milliseconds<span class="token punctuation">:</span> <span class="token number">500</span><span class="token punctuation">)</span><span class="token punctuation">,</span> vsync<span class="token punctuation">:</span> <span class="token keyword">this</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
Animation<span class="token operator">&lt;</span>int<span class="token operator">&gt;</span> alpha <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">IntTween</span><span class="token punctuation">(</span>begin<span class="token punctuation">:</span> <span class="token number">0</span><span class="token punctuation">,</span> end<span class="token punctuation">:</span> <span class="token number">255</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">animate</span><span class="token punctuation">(</span>controller<span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
<p>&#x6CE8;&#x610F;<code>animate()</code>&#x8FD4;&#x56DE;&#x7684;&#x662F;&#x4E00;&#x4E2A;Animation&#xFF0C;&#x800C;&#x4E0D;&#x662F;&#x4E00;&#x4E2A;Animatable&#x3002;</p>
<p>&#x4EE5;&#x4E0B;&#x793A;&#x4F8B;&#x6784;&#x5EFA;&#x4E86;&#x4E00;&#x4E2A;&#x63A7;&#x5236;&#x5668;&#x3001;&#x4E00;&#x6761;&#x66F2;&#x7EBF;&#x548C;&#x4E00;&#x4E2A;Tween&#xFF1A;</p>
<pre class="language-"><code class="lang-dart"><span class="token keyword">final</span> AnimationController controller <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">AnimationController</span><span class="token punctuation">(</span>
    duration<span class="token punctuation">:</span> <span class="token keyword">const</span> <span class="token function">Duration</span><span class="token punctuation">(</span>milliseconds<span class="token punctuation">:</span> <span class="token number">500</span><span class="token punctuation">)</span><span class="token punctuation">,</span> vsync<span class="token punctuation">:</span> <span class="token keyword">this</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">final</span> Animation curve <span class="token operator">=</span>
    <span class="token keyword">new</span> <span class="token class-name">CurvedAnimation</span><span class="token punctuation">(</span>parent<span class="token punctuation">:</span> controller<span class="token punctuation">,</span> curve<span class="token punctuation">:</span> Curves<span class="token punctuation">.</span>easeOut<span class="token punctuation">)</span><span class="token punctuation">;</span>
Animation<span class="token operator">&lt;</span>int<span class="token operator">&gt;</span> alpha <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">IntTween</span><span class="token punctuation">(</span>begin<span class="token punctuation">:</span> <span class="token number">0</span><span class="token punctuation">,</span> end<span class="token punctuation">:</span> <span class="token number">255</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">animate</span><span class="token punctuation">(</span>curve<span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="./" class="navigation navigation-prev " aria-label="Previous page: 动画">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="animation_structure.html" class="navigation navigation-next " aria-label="Next page: 动画结构">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"Flutter动画简介","level":"1.10.1","depth":2,"next":{"title":"动画结构","level":"1.10.2","depth":2,"path":"chapter9/animation_structure.md","ref":"chapter9/animation_structure.md","articles":[]},"previous":{"title":"动画","level":"1.10","depth":1,"path":"chapter9/index.md","ref":"chapter9/index.md","articles":[{"title":"Flutter动画简介","level":"1.10.1","depth":2,"path":"chapter9/intro.md","ref":"chapter9/intro.md","articles":[]},{"title":"动画结构","level":"1.10.2","depth":2,"path":"chapter9/animation_structure.md","ref":"chapter9/animation_structure.md","articles":[]},{"title":"自定义路由过渡动画","level":"1.10.3","depth":2,"path":"chapter9/route_transition.md","ref":"chapter9/route_transition.md","articles":[]},{"title":"Hero动画","level":"1.10.4","depth":2,"path":"chapter9/hero.md","ref":"chapter9/hero.md","articles":[]},{"title":"交错动画","level":"1.10.5","depth":2,"path":"chapter9/stagger_animation.md","ref":"chapter9/stagger_animation.md","articles":[]}]},"dir":"ltr"},"config":{"plugins":["-search","search-pro","ace","splitter","toggle-chapters","prism","donate","-highlight"],"root":"docs","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{"lang":{"shell":"bash"}},"ace":{},"splitter":{},"search-pro":{"cutWordLib":"nodejieba","defineWord":["Gitbook Use"]},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"donate":{"alipay":"","alipayText":"支付宝打赏","button":"赏","title":"","wechat":"https://cdn.jsdelivr.net/gh/flutterchina/flutter-in-action@1.0.3/docs/imgs/pay.jpeg","wechatText":"微信打赏"},"fontsettings":{"theme":"white","family":"sans","size":2},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"toggle-chapters":{}},"theme":"default","author":"wendux 824783146@qq.com","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"《Flutter实战》","language":"zh-hans","links":{"sharing":{"all":null,"facebook":null,"google":null,"twitter":null,"weibo":null},"sidebar":{"<div><img height=20 style='position:relative; top:5px; padding-right:5px ' src='https://cdn.jsdelivr.net/gh/flutterchina/website@1.0/images/favicon.png'/> Flutter中文网</div>":"https://flutterchina.club"}},"gitbook":"*","description":"记录Gitbook的配置和一些插件的使用"},"file":{"path":"chapter9/intro.md","mtime":"2018-12-09T13:12:23.249Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2019-05-14T10:32:57.346Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>



    <script src="https://cdn.jsdelivr.net/gh/flutterchina/flutter-in-action/_book/gitbook/gitbook.js"></script>
    <script src="https://cdn.jsdelivr.net/gh/flutterchina/flutter-in-action/_book/gitbook/theme.js"></script>
    
        
        <script src="https://cdn.jsdelivr.net/gh/flutterchina/flutter-in-action/_book/gitbook/gitbook-plugin-search-pro/jquery.mark.min.js"></script>
        
    
        
        <script src="https://cdn.jsdelivr.net/gh/flutterchina/flutter-in-action/_book/gitbook/gitbook-plugin-search-pro/search.js"></script>
        
    
        
        <script src="https://cdn.jsdelivr.net/gh/flutterchina/flutter-in-action/_book/gitbook/gitbook-plugin-ace/ace/ace.js"></script>
        
    
        
        <script src="https://cdn.jsdelivr.net/gh/flutterchina/flutter-in-action/_book/gitbook/gitbook-plugin-ace/ace.js"></script>
        
    
        
        <script src="https://cdn.jsdelivr.net/gh/flutterchina/flutter-in-action/_book/gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="https://cdn.jsdelivr.net/gh/flutterchina/flutter-in-action/_book/gitbook/gitbook-plugin-toggle-chapters/toggle.js"></script>
        
    
        
        <script src="https://cdn.jsdelivr.net/gh/flutterchina/flutter-in-action/_book/gitbook/gitbook-plugin-donate/plugin.js"></script>
        
    
        
        <script src="https://cdn.jsdelivr.net/gh/flutterchina/flutter-in-action/_book/gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="https://cdn.jsdelivr.net/gh/flutterchina/flutter-in-action/_book/gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="https://cdn.jsdelivr.net/gh/flutterchina/flutter-in-action/_book/gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="https://cdn.jsdelivr.net/gh/flutterchina/flutter-in-action/_book/gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    


<script>
    var _hmt = _hmt || [];
    $("#bd").remove();
    (function () {
        var hm = document.createElement("script");
        hm.src = "https://hm.baidu.com/hm.js?170231fea4f81697eb046edc1a91fe5b";
        var s = document.getElementsByTagName("script")[0];
        hm.id = "bd"
        s.parentNode.insertBefore(hm, s);
    })();

    function init() {
        var p = location.pathname;
        _hmt.push(['_trackPageview', p]);
        if (p[p.length - 1] === '/') {
            p += "index.md"
        } else {
            p = p.split(".")[0] + ".md";
        }
        p = "https://github.com/flutterchina/flutter-in-action/blob/master/docs" + p;
        $(".pull-right .fa-edit").parent("a").attr("href", p);
        $("table").wrap("<div style='overflow: auto'></div>");
        //百度统计
        var e = /([http|https]:\/\/[a-zA-Z0-9\_\.]+\.baidu\.com)/gi, r = window.location.href,
            t = document.referrer;
        if (!e.test(r)) {
            var o = "https://sp0.baidu.com/9_Q4simg2RQJ8t7jm9iCKT-xh_/s.gif";
            t ? (o += "?r=" + encodeURIComponent(document.referrer), r && (o += "&l=" + r)) : r && (o += "?l=" + r);
            var i = new Image;
            i.src = o
        }
        $(".copyright").remove();
        $("<div class='copyright'> 本书仍在勘误阶段，请勿以任何形式私自传播，作者保留对本书的版权。</div>").appendTo(".page-inner");
    }

    function hookAPI(api, ob, fn) {
        return function () {
            var result = api.apply(ob, [].slice.call(arguments));

            setTimeout(fn, 1000);
            return result;
        }
    }

    function addAD() {
        if (location.href !== 'https://book.flutterchina.club/' && $("#book-search-results .ad").length == 0) {
            var id=Math.ceil(Math.random()*10)%2;
            $(".ad"+id).clone().hide().fadeIn().prependTo("#book-search-results")
            setTimeout(function () {
                $(".body-inner").animate({scrollTop: 0}, 200)
            }, 800);
        }
    }

    function _track(p,url) {
        _hmt.push(['_trackEvent', 'ad', 'click', p]);
        setTimeout(function () {
            location.href = url
        }, 100);
    }

    // setInterval(addAD, 300);

    init();


    if (history.pushState) {
        history.pushState = hookAPI(history.pushState, history, init);
    }

</script>
</body>

</html>

